﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MainPage.master" CodeFile="TeamProfile.aspx.cs" Inherits="Teams_TeamProfile" %>


<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder2">
    <div style="margin-bottom: 10px; height: 836px; width: 600px;">
                    <div style="height: 838px" align="center">
                        <table style="width: 100%; height: 600px;">
                            <tr>
                                <td bgcolor="White" colspan="6">
                                    <asp:Label ID="nazwaDruzyny" runat="server" Font-Bold="True" Font-Size="Larger"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="6" style="height: 21px">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="3">
                                    <asp:Image ID="logo" runat="server" Height="250px" Width="219px" 
                                        ImageUrl="~/images/dafault_team.jpg" />
                                </td>
                                <td style="width: 148px" rowspan="4">
                                    &nbsp;</td>
                                <td align="center" colspan="2">
                                    <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Zawodnicy"></asp:Label>
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="2" style="vertical-align: top">
                                    <asp:GridView 
                                        ID="GridView1" 
                                        runat="server" 
                                        AutoGenerateColumns="False" 
                                        DataSourceID="dbzawodnicy" 
                                        DataKeyNames="id_zawodnika"
                                        Height="87%" 
                                        Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None">
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <RowStyle BackColor="#EFF3FB" />
                                        <Columns>
                                            <asp:HyperLinkField DataTextField="imie"
                                                DataNavigateUrlFields="id_zawodnika"
                                                DataNavigateUrlFormatString="PlayerProfile.aspx?id={0}&action=view"
                                                HeaderText="Imie:" >
                                                <HeaderStyle HorizontalAlign="Left" />
                                                <ItemStyle HorizontalAlign="Left" />
                                            </asp:HyperLinkField>
                                            <asp:HyperLinkField DataTextField="nazwisko"
                                                DataNavigateUrlFields="id_zawodnika"
                                                DataNavigateUrlFormatString="PlayerProfile.aspx?id={0}&action=view"
                                                HeaderText="Nazwisko:" >    
                                                <HeaderStyle HorizontalAlign="Left" />
                                                <ItemStyle HorizontalAlign="Left" />
                                            </asp:HyperLinkField>
                                            <asp:BoundField DataField="pozycja" HeaderText="pozycja" 
                                                SortExpression="Pozycja" >
                                                <HeaderStyle HorizontalAlign="Left" />
                                                <ItemStyle HorizontalAlign="Left" />
                                            </asp:BoundField>
                                        </Columns>
                                        
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                        
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="dbzawodnicy" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ZALSConnectionString %>" 
                                        
                                        
                                        
                                        SelectCommand="SELECT [id_zawodnika], [imie], [nazwisko], [pozycja] FROM [ZAWODNICY] WHERE ([id_druzyny] = @id_druzyny) AND status = 1" 
                                        ProviderName="<%$ ConnectionStrings:ZALSConnectionString.ProviderName %>">
                                        <SelectParameters>
                                            <asp:QueryStringParameter Name="id_druzyny" QueryStringField="t" Type="Int32" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                </td>
                                <td style="height: 14px">
                                    </td>
                            </tr>
                            <tr>
                                <td style="height: 185px">
                                    </td>
                            </tr>
                            <tr>
                                <td style="width: 153px; height: 14px;">
                                    </td>
                                <td style="width: 179px; height: 14px;">
                                </td>
                                <td style="height: 14px">
                                    </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td align="left" colspan="4" width="200px">
                                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                                        CellPadding="4" DataSourceID="dbDruzyny" ForeColor="#333333" GridLines="None" 
                                        Height="50px" Width="250px">
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
                                        <RowStyle BackColor="#EFF3FB" />
                                        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <Fields>
                                            <asp:BoundField DataField="miasto" HeaderText="Miasto" />
                                            <asp:HyperLinkField DataNavigateUrlFields="strona_www" 
                                                DataNavigateUrlFormatString="{0}" DataTextField="strona_www" 
                                                HeaderText="Strona www" />
                                            <asp:HyperLinkField DataNavigateUrlFields="trener" DataTextField="nazwisko" 
                                                HeaderText="Trener" 
                                                DataNavigateUrlFormatString="PlayerProfile.aspx?id={0}&amp;action=view" />
                                            <asp:BoundField DataField="opis" HeaderText="Opis" />
                                        </Fields>
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:DetailsView>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td style="width: 365px" align="right">
                                    <asp:Button ID="Button3" runat="server" Height="25px" onclick="Button3_Click" 
                                        Text="Dodaj zawodnika" Width="130px" OnPreRender="Button3_PreRender" />
                                </td>
                                <td style="width: 174px" align="right">
                                    <asp:Button ID="Button2" runat="server" Height="25px" onclick="Button2_Click" 
                                        Text="Idź do drużyn" Width="130px" />
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="5">
                                    <asp:Label ID="Label1" runat="server" Text="Dodaj komentarz"></asp:Label>
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="5">
                                    <asp:TextBox ID="TextBox1" runat="server" Height="75px" TextMode="MultiLine" 
                                        Width="600px"></asp:TextBox>
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td style="width: 365px">
                                    &nbsp;</td>
                                <td style="width: 174px">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td style="width: 365px">
                                    &nbsp;</td>
                                <td style="text-align: right;">
                                    <asp:Button ID="Button1" runat="server" Height="25px" onclick="Button1_Click" 
                                        Text="Dodaj komentarz" Width="130px" />
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td style="width: 365px">
                                    &nbsp;</td>
                                <td style="text-align: right;">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="5">
                                    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                        CellPadding="4" DataKeyNames="id_komentarza" DataSourceID="dbKomentarze" 
                                        ForeColor="#333333" GridLines="None" Width="100%">
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <RowStyle BackColor="#EFF3FB" />
                                        <Columns>
                                            <asp:BoundField DataField="autor" HeaderText="Autor" SortExpression="autor">
                                                <ItemStyle HorizontalAlign="Left" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="data" DataFormatString="{0:yyyy-MM-dd}" 
                                                HeaderText="Data" SortExpression="data">
                                                <HeaderStyle Width="100px" />
                                                <ItemStyle HorizontalAlign="Left" Width="80px" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="tresc" HeaderText="Tresc" SortExpression="tresc" >
                                                <ItemStyle HorizontalAlign="Left" />
                                            </asp:BoundField>
                                        </Columns>
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="dbKomentarze" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ZALSConnectionString %>" 
                                        SelectCommand="SELECT [id_komentarza], [autor], [data], [tresc] FROM [KOMNETARZE] WHERE ([id_druzyny] = @id_druzyny) ORDER BY [data] DESC">
                                        <SelectParameters>
                                            <asp:QueryStringParameter Name="id_druzyny" QueryStringField="t" Type="Int32" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td colspan="2">
                                    &nbsp;</td>
                                <td style="width: 365px">
                                    &nbsp;</td>
                                <td style="width: 174px">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            </table>
                        <asp:SqlDataSource ID="dbDruzyny" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ZALSConnectionString %>" 
                            
                            
                            SelectCommand="SELECT t.[id_druzyny], [trener], [nazwa], t.[miasto], t.[zdjecie], [logo], [strona_www], u.[imie], u.[nazwisko], [opis] FROM [DRUZYNY] t JOIN [ZAWODNICY] u ON t.[trener] = u.[id_zawodnika] WHERE (t.[id_druzyny] = @ID)" 
                            ProviderName="<%$ ConnectionStrings:ZALSConnectionString.ProviderName %>">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="ID" QueryStringField="t" Type="Int64" 
                                    DefaultValue="" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
</div>

</asp:Content>
